﻿package component.tree.service;

import java.util.List;

import component.tree.dao.ITreeDAO;
import component.tree.dao.TreeDAO;
import component.tree.entity.Tree;
import component.tree.model.TreeModel;

public class TreeService extends ComponentService implements ITreeService{
	ITreeDAO treeDAO = new TreeDAO();
	
	//通过sql查询树型数据,返回List<Tree>
	public List getTreeDataBySql(String sql){
		List treeList = this.getDataBySql(sql);
		
		//组装树型数据
		
		return treeList;
	}
	
	//通过sql查询树型数据,返回List<Tree>
	public List getTreeDataBySql(String sql,Tree tree){
		List treeList = this.getDataBySql(sql,tree);
		
		//组装树型数据
		ITreeOrder treeOrder = new TreeOrder2();
		treeList = treeOrder.orderTree(treeList);
		
		return treeList;
	}
	
	/**
	 * 根据父节点id查找所有子节点
	 */
	public List getTreeDataByParentId(String parentId,TreeModel treeModel) {
		List childList = treeDAO.findTreeDataByParentId(parentId, treeModel);
		return childList;
	}
}
